Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIH: Publish Aux Global Positon #24051

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

SIH: Publish Aux Global Positon #24051

wants to merge 5 commits into from

Conversation

bresch
Copy link
Member

@bresch bresch commented Nov 28, 2024

Solved Problem

I need to test Aux Global Position (AGP) in sim.

Solution

Implement SensorAgpSim to publish AGP based on groundtruth data.

image

@bresch bresch added the Sim: SITL software in the loop simulation label Nov 28, 2024
@bresch bresch requested a review from dagar November 28, 2024 15:35
@bresch bresch self-assigned this Nov 28, 2024
Copy link

github-actions bot commented Nov 28, 2024

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 8 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%      +8  +0.0%      +8    .text
  +0.0%      +5  +0.0%      +5    ROMFS/nsh_romfsimg.c
  +0.0%      +3  +0.0%      +3    [section .text]
+0.0%     +56  [ = ]       0    .debug_abbrev
   +11%     +56  [ = ]       0    ../../src/lib/version/version.c
-0.0%      -8  [ = ]       0    .debug_aranges
  -5.0%      -8  [ = ]       0    ../../src/lib/version/version.c
-0.0%      -4  [ = ]       0    .debug_info
  -0.2%      -4  [ = ]       0    ../../src/lib/version/version.c
-0.0%     -28  [ = ]       0    .debug_line
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  -0.3%      -3  [ = ]       0    task/task_cancelpt.c
-0.0%      -8  [ = ]       0    .debug_ranges
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
-0.1%      -8  [ = ]       0    [Unmapped]
+0.0%      +8  +0.0%      +8    TOTAL

px4_fmu-v6x [Total VM Diff: 16 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +16  +0.0%     +16    .text
  +0.0%      +8  +0.0%      +8    [section .text]
  +0.0%      +5  +0.0%      +5    ROMFS/nsh_romfsimg.c
  +0.2%      +3  +0.2%      +3    ../../src/systemcmds/ver/ver.cpp
+0.0%     +56  [ = ]       0    .debug_abbrev
   +11%     +56  [ = ]       0    ../../src/lib/version/version.c
-0.0%      -8  [ = ]       0    .debug_aranges
  -5.0%      -8  [ = ]       0    ../../src/lib/version/version.c
-0.0%      -4  [ = ]       0    .debug_info
  -0.2%      -4  [ = ]       0    ../../src/lib/version/version.c
-0.0%     -28  [ = ]       0    .debug_line
  -1.3%     -25  [ = ]       0    ../../src/lib/version/version.c
  -0.3%      -3  [ = ]       0    task/task_cancelpt.c
-0.0%      -8  [ = ]       0    .debug_ranges
  -2.6%      -8  [ = ]       0    ../../src/lib/version/version.c
-0.0%     -16  [ = ]       0    [Unmapped]
+0.0%      +8  +0.0%     +16    TOTAL

Updated: 2024-12-10T14:27:34

@bresch bresch force-pushed the pr_ekf2_ellipsoidal_sih branch from 3b401e2 to a984d0d Compare November 29, 2024 12:11
Base automatically changed from pr_ekf2_ellipsoidal_sih to main November 29, 2024 13:21
@bresch bresch marked this pull request as ready for review December 6, 2024 15:08
*
****************************************************************************/
/**
* Simulate Aux Global Position (AGP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Simulate Aux Global Position (AGP)
* Simulate Aux Global Position (AGP) in SIH

PARAM_DEFINE_INT32(SENS_EN_AGPSIM, 0);

/**
* AGP failure mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* AGP failure mode
* AGP failure mode (in SIH)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That param could use some more description.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think the original objective for this simulation module is to be re-used in multiple simulators, not only SIH.

@@ -0,0 +1,202 @@
/****************************************************************************
*
* Copyright (c) 2021 PX4 Development Team. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2021 PX4 Development Team. All rights reserved.
* Copyright (c) 2024 PX4 Development Team. All rights reserved.


if (phase) {
do {
float U1 = (float)rand() / (float)RAND_MAX;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why did you change from the static cast used in BlockRandGauss.hpp to the regular cast?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dumbly copy-pasted the SensorGpsSim class.
I think it requires some refactoring as it's nonsense to re-declare that function in every class. I don't understand if there is was a real reason to not have a common lib.

_position_bias.zero();
}

double latitude = _measured_lla.latitude_deg() + math::degrees((double)generate_wgn() * 2.0 /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
double latitude = _measured_lla.latitude_deg() + math::degrees((double)generate_wgn() * 2.0 /
const double latitude = _measured_lla.latitude_deg() + math::degrees((double)generate_wgn() * 2.0 /

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and below

PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Module to simulate auxiliary global position measurements with optional failure modes for SIH simulation.

CONSTANTS_RADIUS_OF_EARTH);
double longitude = _measured_lla.longitude_deg() + math::degrees((double)generate_wgn() * 2.0 /
CONSTANTS_RADIUS_OF_EARTH);
double altitude = (double)(_measured_lla.altitude() + (generate_wgn() * 0.5f));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you come up with the scales for the noise? Maybe worth some comments. And should we maybe define the scales somewhere centrally and then also scale .eph and .epv accordingly? Such that you can simulate easily with different noise levels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe as parameters? So we can then change the noise level during the simulation.

* @group Simulator
* @min 0
* @max 3
* @bit 0 Constant
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about calling it "Measurement stuck "?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wasn't sure if "frozen", "stuck" or "constant" would be more appropriate; I can change it to "stuck" if you find it clearer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sim: SITL software in the loop simulation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants